home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / site / DBD / Sponge.pm < prev   
Encoding:
Text File  |  1999-12-28  |  1.5 KB  |  89 lines

  1. {
  2.     package DBD::Sponge;
  3.  
  4.     require DBI;
  5.  
  6.     @EXPORT = qw(); # Do NOT @EXPORT anything.
  7.  
  8.  
  9.     $drh = undef;    # holds driver handle once initialised
  10.     $err = 0;        # The $DBI::err value
  11.  
  12.     sub driver{
  13.     return $drh if $drh;
  14.     my($class, $attr) = @_;
  15.     $class .= "::dr";
  16.     ($drh) = DBI::_new_drh($class, {
  17.         'Name' => 'Sponge',
  18.         'Version' => '$Revision: 1.1 $',
  19.         'Attribution' => 'DBD Sponge (fake cursor driver) by Tim Bunce',
  20.         });
  21.     $drh;
  22.     }
  23.  
  24.     1;
  25. }
  26.  
  27.  
  28. {   package DBD::Sponge::dr; # ====== DRIVER ======
  29.     $imp_data_size = 0;
  30.     sub disconnect_all { }
  31.     sub DESTROY { }
  32. }
  33.  
  34.  
  35. {   package DBD::Sponge::db; # ====== DATABASE ======
  36.     $imp_data_size = 0;
  37.     use strict;
  38.  
  39.     sub prepare {
  40.     my($dbh, $statement, $attribs) = @_;
  41.  
  42.     my($outer, $sth) = DBI::_new_sth($dbh, {
  43.         'Statement'   => $statement,
  44.         'rows'        => $attribs->{'rows'},
  45.         });
  46.  
  47.     $outer;
  48.     }
  49.  
  50.     sub DESTROY { }
  51. }
  52.  
  53.  
  54. {   package DBD::Sponge::st; # ====== STATEMENT ======
  55.     $imp_data_size = 0;
  56.     use strict;
  57.  
  58.     sub execute {
  59.     my($sth, $dir) = @_;
  60.     1;
  61.     }
  62.  
  63.     sub fetch {
  64.     my($sth) = @_;
  65.     my $row = shift(@{$sth->{'rows'}});
  66.     return $row if $row;
  67.     $sth->finish;     # no more data so finish
  68.     return undef;
  69.     }
  70.  
  71.     sub finish {
  72.     my($sth) = @_;
  73.     }
  74.  
  75.     sub FETCH {
  76.     my ($sth, $attrib) = @_;
  77.     return $sth->DBD::_::dr::FETCH($attrib);
  78.     }
  79.  
  80.     sub STORE {
  81.     my ($sth, $attrib, $value) = @_;
  82.     return $sth->DBD::_::dr::STORE($attrib, $value);
  83.     }
  84.  
  85.     sub DESTROY { }
  86. }
  87.  
  88. 1;
  89.